<template>
<div>
  <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
    <el-tab-pane label="合同及基本信息" name="first">
        <PactMessage  :tableData="tableData"></PactMessage>
    </el-tab-pane>
    <el-tab-pane label="付款/回款/保证金信息" name="second">
        <BailBond :tableData="tableData"></BailBond>
    </el-tab-pane>
   
    <el-tab-pane label="汽车信息" name="fourth">
        <CarMessage :tableData="tableData"></CarMessage>
    </el-tab-pane>
     <el-tab-pane label="退单信息" name="third"  v-if="tableData.status<-10000&&-10040<tableData.status"  >
        <RefundInfo :tableData="tableData"></RefundInfo>
    </el-tab-pane>
  </el-tabs>
      <div style='textAlign:center;marginTop:50px'>
        
        <el-button type="primary" @click='resetForm'>返回</el-button>
      </div>
  </div>
</template>
<script>
import PactMessage from './PactMessage' ;   //合同信息组件
import BailBond from './BailBond';          //保证金信息组件
// import InvestMessage from './InvestMessage' // 放款信息组件
import CarMessage from './CarMessage'       //汽车信息组件
import RefundInfo from  './RefundInfo'      //退单信息组件
import qiniu from '@/views/qiniu/upload';
import agentHttp from '@/utils/agentHttp.js';
import {qiniuArray} from '@/utils/index.js'; 
  export default {
    data() {
      return {
        activeName2: 'first',
        tableData:{},
      };
    },
    methods: {
      handleClick(tab, event) {
        console.log(tab, event);
      },
       resetForm(formName) {
        // this.$refs[formName].resetFields();
        this.dialogSendData.dialogFormVisible = false;
      },
       initData() { //初始化数据
         
       
        agentHttp.get(`adminApi/admin/mortgage_order_risk/manage_order_detail/${this.mortgageOrderExtendId}`).then((data) => {
          this.tableData = Object.assign({}, data.data, this.tableData)

          //青牛的图片
           if(this.tableData.voucherPic!==null){       //字段为null的处理
                    this.tableData.voucherPics = {     
                    id:'qiniuImage',
                    image_uri:this.tableData.voucherPic.split(',').notempty()    // 保证金凭证的照片
                  }
           }else{
              this.tableData.voucherPics = {     
                    id:'qiniuImage',
                    image_uri:"dd,pp".split(',').notempty()    // 保证金凭证的照片
                  }
           }
                  qiniuArray(this.tableData)
        })
      },
    },
    components:{
        PactMessage,
        BailBond,
        // InvestMessage,
        CarMessage,
        RefundInfo
    },
    props:{
      dialogSendData:{
        type:Object,
      },
      mortgageOrderExtendId:{
        type:Number
      }
    },
    mounted(){
        this.initData()
       
    }
  };
</script>